#ifndef PID_H
#define PID_H

#define cooling 1
#define heating 0

struct {
short set_temperature;
short set_op;
char edge;
}str_PID;
 
typedef struct {
short temperature_max;
short temperature_min;
short op_max;
short op_min;
} STR_EXTREMUM;

void start_automation_setting(void);
void stop_automation_setting(void);
void PID_update(short );
void PID_init(float ,float ,float ,short ,short ,short  );

void cooling_heating_cycles (unsigned char , STR_EXTREMUM* );

/*********************************************************
 *
 * Data Type:   PID_PARAMS structure
 *
 * Contents:    all values used by the PID simulation,
 *              plus a cycle count
 *
 ********************************************************/
typedef struct
{
  float p_gain;      /* 'P' proportional gain          */
  float i_gain;      /* 'I' integral gain              */
  float d_gain;      /* 'D' derivative gain            */
  float acc_ff;      /* 'A' acceleration feed forward  */
  float fri_ff;      /* 'F' friction feed forward      */
  float vel_ff;      /* 'V' velocity feed forward      */
  float hold;        /* 'H' output Hold                */
  float bias;        /* 'B' bias                       */
  float accel;       /* 'R' acceleration rate          */
  short setpt;       /* 'S' set point                  */
  float trans;       /* 'T' transfer ratio             */
  float lag;         /* 'L' lag in output change       */
  short min;         /* 'N' minimum output value       */
  short max;         /* 'M' maximum output value       */
  float cycles;      /* 'Y' repeat cycle count         */
  float slew;        /* 'W' maximum slew rate          */
} PID_PARAMS;


#endif
